package ch.exm.storm.conditions;

import java.util.Set;

import ch.exm.storm.query.relational.RelationalQuery;


public interface Condition {

	/**
	 * Evaluate this condition
	 * @param query - The query against which this condition is evaluated
	 * @return true if this condition can be translated in a relational query, 
	 * false if it's necessary to evaluate it against the concrete object 
	 */
	boolean evaluateRelationalCondition(RelationalQuery query);

	/**
	 * @return The where statement for the relational part of this condition
	 */
	String getWhereStatement();
	
	/**
	 * Puts this condition in and with the given one
	 * @param condition - The condition to put in and with this one
	 * @return The resulting AND condition 
	 */
	And and(Condition condition);

	/**
	 * Puts this condition in or with the given one
	 * @param condition - The condition to put in or with this one
	 * @return The resulting OR condition 
	 */
	Or or(Condition condition);
	
	/**
	 * Evaluates if the object matches this condition 
	 * @param object - The object to be matched against this condition
	 * @return true if the object matches this condition, false otherwise
	 */
	boolean matches(Object object);
	
	/**
	 * Returns all the distinct classes used as arguments in this condition
	 * @return All the classes in this condition
	 */
	Set<Class<?>> getQueriedClasses();
}
